/**
 * 
 */
package javacommon.util;

import java.net.*;
import java.io.*;

public class ConnectURL {

	/**
	 * 
	 * @param urlvalue
	 * 
	 * @return 获取url内容
	 */
	public static String check(String urlvalue) {

		String inputLine = "";
		String line2 = "";

		try {
			URL url = new URL(urlvalue);

			HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();

			BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
			while ((line2 = in.readLine()) != null) {
				inputLine += line2;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		// System.out.println(inputLine); 系统打印出抓取得验证结果

		return inputLine;
	}

	public static InputStream getContent(String urlvalue) {
		InputStream inputLine = null;
		try {
			URL url = new URL(urlvalue);
			HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();

			inputLine = urlConnection.getInputStream();

		} catch (Exception e) {
			e.printStackTrace();
		}
		return inputLine;
	}

	public static void main(String a[]) {
		System.out.println(ConnectURL.check(a[0]));
	}

}
